﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="TestPage.aspx.cs" Inherits="TestPage" Title="Untitled Page" EnableEventValidation="false" %>

<%@ MasterType VirtualPath="~/MasterPage.master" %>
<%@ Register Namespace="CustomControlsNS" TagPrefix="cc2" %>
<%@ Register Namespace="AjaxControlToolkitCustom" TagPrefix="AJAXCC" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderContent" runat="Server">
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>
            <asp:LinkButton ID="lnkTest" runat="server">Click Me</asp:LinkButton>
            <%--<AJAXCC:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="lnkTest"
                    ConfirmText="Are you sure you want to click this?" />--%>
            <ajaxToolKit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="lnkTest"
                ConfirmText="Are you sure you want to click this?" />
            <br />
            <br />
            <div>
                X:<input id="xPos" runat="server" type="text" style="width: 50px;" />
                Y:<input id="yPos" runat="server" type="text" style="width: 50px;" /></div>
            <br />
            <div runat="server" id="divPanel" class="divAnimation" style="width: 30%; background-color: blue;">
                <div style="text-align: left; cursor: hand" onclick="show_hide()">
                    <u>Test</u></div>
                <td align="center">
                    <a href="bcpr:"></a>
                </td>
                <div runat="server" id="divContent" class="divContent" visible="true" style="width: 30%;
                    background-color: yellow;">
                    <fieldset>
                        <asp:Image ID="imgLang_ro" runat="server" ImageUrl="~/Images/Flags/flag_ro-RO.jpg"
                            Style="cursor: pointer;" onclick="ChangeLanguage('ro-RO', true);" ToolTip="<%$ Resources:GridView, Lang_RO %>" />
                        sadsadsa
                        <br />
                        sdsadsa<br />
                        sadsadsa
                        <br />
                        sdsadsa<br />
                        sadsadsa
                        <br />
                        sadsadsa
                        <br />
                        sdsadsa<br />
                        sdsadsa<br />
                        sadsadsa
                        <br />
                        sdsadsa<br />
                        sadsadsa
                        <br />
                        sdsadsa<br />
                        sadsadsa
                    </fieldset>
                </div>
            </div>
            <asp:Panel ID="Panel6" runat="server" Width="250px" Style="z-index: 20;">
                <asp:Panel ID="Panel7" runat="server" Width="100%" Height="20px" BorderStyle="Solid"
                    BorderWidth="2px" BorderColor="black" Style="cursor: move; text-align: center">
                    <div class="dragMe">
                        Drag Me</div>
                </asp:Panel>
                <asp:Panel ID="Panel8" runat="server" Width="100%" Height="250px" Style="overflow: auto;"
                    BackColor="#0B3D73" ForeColor="whitesmoke" BorderWidth="2px" BorderColor="black"
                    BorderStyle="Solid">
                    <div>
                        <input id="Button1" type="button" value="hidePanel" onclick="hidePanel();" />
                        <asp:Button ID="btnTest" runat="server" Text="Test" OnClientClick="showPanel();" />
                        <asp:TextBox ID="textB" runat="server" Width="100" />
                    </div>
                </asp:Panel>
            </asp:Panel>
            <ajaxToolKit:DragPanelExtender ID="DragPanelExtender1" runat="server" BehaviorID="dpe"
                TargetControlID="Panel6" DragHandleID="Panel7" ViewStateMode="Enabled" />
            <input id="Button3" type="button" value="showPanel" onclick="showPanel();" />
            <asp:Button ID="btn_Test" runat="server" OnClick="btnTest_Click" Text="Test" />
            <asp:TextBox ID="txtTest" runat="server" Width="100" />
            <asp:HiddenField ID="HiddenField1" runat="server" Value="0" />
            <asp:HiddenField ID="HiddenField2" runat="server" Value="0" />
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
    <script type="text/javascript">
        var g_str_divPanel = '<% =divPanel.ClientID %>';
        var g_str_divContent = '<% =divContent.ClientID %>';
        var g_str_xPos = '<% =xPos.ClientID %>';
        var g_str_yPos = '<% =yPos.ClientID %>';

        var g_str_Panel6 = '<% =Panel6.ClientID %>';

        Sys.Application.add_load(initialize);

        function initialize() {
            var elem = $get("<%=HiddenField2.ClientID%>");
            if (elem.value == '0') {
                var xPos = get_W();
                var yPos = get_H();
                $get(g_str_Panel6).style.visibility = "hidden";
                $find('<%=DragPanelExtender1.BehaviorID%>').set_location(new Sys.UI.Point(parseInt(xPos / 3), parseInt(yPos / 4)));
            }
            else {
                $get(g_str_Panel6).style.visibility = "visible";
                var elem = $get("<%=HiddenField1.ClientID%>");
                if (elem.value != "0") {
                    var temp = new Array();
                    temp = elem.value.split(';');
                    $find('<%=DragPanelExtender1.BehaviorID%>').set_location(new Sys.UI.Point(parseInt(temp[0]), parseInt(temp[1])));
                }
            }
        }

        function showPanel() {
            $get("<%=HiddenField2.ClientID%>").value = '1'
            $get(g_str_Panel6).style.visibility = "visible";
            $find('dpe').add_move(savePanelPosition);
        }

        function hidePanel() {
            $get("<%=HiddenField2.ClientID%>").value = '0'
            $get(g_str_Panel6).style.visibility = "hidden";
            $find('dpe').add_move(savePanelPosition);
        }

        function savePanelPosition() {
            var elem = $find('dpe').get_element();
            var loc = $common.getLocation(elem);
            var elem1 = $get("<%=HiddenField1.ClientID%>");
            elem1.value = loc.x + ';' + loc.y;
        }

        //////////////////^^^^^////////////////////////////////////

        var intHide;
        var intShow;
        var delayTimer = 1000;
        var timer = null;
        var timeStr;

        function animateX(i, j) {
            if (arguments.length) { this.getready(i, j); }
        }

        animateX.prototype.getready = function (i, j) {
            this.i = i;
            this.j = j;
            this.b = 0;
            this.speed = 15;
        };
        animateX.prototype.show = function () {
            $get(g_str_divContent).style.display = '';
            if (this.i < this.j) {
                this.i = this.i + this.speed;
                $get(g_str_divContent).style.height = this.i + "px";
            }
            else {
                $get(g_str_divContent).style.display = '';
                StopTheTimer(intHide);
            }
        };

        animateX.prototype.hide = function () {
            if (this.j > this.i) {
                this.j = this.j - this.speed;
                $get(g_str_divContent).style.height = this.j + "px";
            }
            else {
                $get(g_str_divContent).style.display = 'none';
                StopTheTimer(intShow);
            }
        };

        var xObj = new animateX(220, 300);

        function init(i, j) {
            this.b = 0;
            $get(g_str_divContent).style.width = i + "px";
            $get(g_str_divContent).style.height = j + "px";
        }

        function show_hide() {
            if (xObj.b == 1) {
                xObj.b = 0;
                clearInterval(intHide);

                intShow = window.setInterval("xObj.show()", 15);
                xObj.i = 20;
                xObj.j = 220;
            }
            else {
                xObj.b = 1;
                clearInterval(intShow);

                //$get(g_str_divContent).style.display = 'none';
                intHide = window.setInterval("xObj.hide()", 15);
                xObj.i = 20;
                xObj.j = 220;
            }
        }

        function StopTheTimer(x) {
            clearTimeout(x);
        }


    </script>
</asp:Content>
